<#macro contentFiles image contentId=''>
    <#local name=image?then('images','files')/>
<table class="list nowrap itemDetail ${name}" addButton="新增${image?then('图片','附件')}" width="100%">
    <thead>
        <tr>
            <th type="attach" name="${name}[#index#].filePath" size="50" fieldClass="required" lookupGroup="${name}[#index#]" lookupUrl="common/upload.html?field=filePath">文件路径</th>
            <th type="textarea" name="${name}[#index#].description" fieldAttrs="{maxlength:280,rows:3,cols:50}">描述</th>
            <th type="text" name="${name}[#index#].sort" fieldClass="required digits" defaultval="#index#" size="5">排序</th>
            <th type="del" width="60">操作</th>
        </tr>
    </thead>
    <tbody>
<#if contentId?has_content>
    <@_contentFileList contentId=contentId image=image>
        <#list page.list as file>
            <tr>
                <td>
                    <input type="hidden" name="${name}[${file?index}].id" value="${file.id}"/>
                    <input type="text" name="${name}[${file?index}].filePath" value="${(file.filePath)!}" size="50" class="required" />
                    <a class="btnAttach" lookupGroup="${name}[${file?index}]" href="common/upload.html?field=filePath&originalField=description${image?then('&onlyImage=true','')}" width="560" height="300" >${image?then('图片','附件')}</a>
                </td>
                <td>
                    <textarea name="${name}[${file?index}].description" rows="3" cols="50" maxlength="280">${(file.description)!}</textarea>
                </td>
                <td>
                    <input type="text" name="${name}[${file?index}].sort" value="${file.sort!}" size="5" maxlength="5"/>
                </td>
                <td>
                    <a href="javascript:void(0)" class="btnDel">删除</a>
                </td>
            </tr>
        </#list>
    </@_contentFileList>
</#if>
    </tbody>
</table>
<#if image>
    <#include "../include_page/preview.html"/>
    <@preview name '.images' 'tr td input[name$=filePath]'/>
</#if>
</#macro>